package chapter03;

public class Test10_Object {
    public static void main(String[] args) {
        Test t = new Test();
        System.out.println(t.toString());
        Test t1 = new Test();
        System.out.println(t.equals(t1));
    }
}
class Test{
    String p = "10";
    public int i = 10;
    @Override
    public String toString() {
        return p;
    }

    @Override
    public boolean equals(Object obj) {
        Test t = (Test) obj; //将父类对象向下转型转成子类对象
        return this.i==t.i;
    }
}
